"""
__project__ = 'thc'
__file_name__ = 'Exceldata'
__author__ = 'thc'
__time__ = '2021/1/4/004 16:23'
__product_name = PyCharm
-*- coding:utf-8 -*-
"""

from openpyxl import load_workbook

class ExcelData(object):
    def __init__(self, excelName, sheetName):
        self.wb = load_workbook(excelName)
        self.sheet = self.wb.get_sheet_by_name(sheetName)
        self.sheetMaxRow = self.sheet.max_row

    def getDataFromSheet(self):
        mylist = []
        for i in self.sheet.rows:
            list = []
            list.append(i[1].value)
            list.append(i[2].value)
            mylist.append(list)
        return mylist[1:]


if __name__ == '__main__':
    excelName =r'./测试数据.xlsx'
    sheetName = '搜索数据表'
    pe = ExcelData(excelName, sheetName)
    pe.getDataFromSheet()



